package com.example.mallsystem1104.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.mallsystem1104.entity.Standard;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @Author zy
 * @Date 2024/12/13 11:01
 * @packageName:com.example.mallsystem1104.mapper
 * @ClassName:StandardMapper
 */
@Mapper
public interface StandardMapper extends BaseMapper<Standard> {
    @Select("select store from good_standard where good_id=#{goodId} and value=#{standard}")
    int getStore(Long goodId, String standard);

    @Update("update good_standard set store=#{num} where good_id=#{goodId} and value=#{standard}")
    void deductStore(Long goodId, String standard, int num);
}
